home *** CD-ROM | disk | FTP | other *** search
/ Chip: 25 Years Anniversary / CHIP_25Jahre_Jubilaeum.iso / G DATA AddOns2 / WebShop / _SETUP.1 / chromeless_30.js < prev    next >
Text File  |  2001-12-18  |  8KB  |  181 lines

  1. /*
  2. CHROMELESS WINDOWS v.30.5
  3. (c) Gabriel Suchowolski power[z]one / www.microbians.com / powerz@microbians.com
  4. Distributed under the terms of the GNU Library General Public License (www.gnu.org)
  5. */
  6. function openchromeless(theURL,wname,W,H,X,Y,NONEgrf,CLOSEdwn,CLOSEup,CLOSEovr,MINIdwn,MINIup,MINIovr,CLOCKgrf,titHTML,titWIN,winBORDERCOLOR,winBORDERCOLORsel,winBGCOLOR,winBGCOLORsel) {
  7. var isie=false
  8. var isv55=false
  9. var iswin=false
  10. if ( navigator.appName=="Microsoft Internet Explorer" && parseInt(navigator.appVersion)>=4 ) {
  11. isie=true
  12. if ( navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE ")+5,navigator.appVersion.indexOf("MSIE ")+8) >=5.5 ) isv55=true
  13. }
  14. if ( navigator.userAgent.toLowerCase().indexOf("win")!=-1 ) iswin=true
  15. if (X==null) X=Math.ceil( (window.screen.width-W) / 2 )
  16. if (Y==null) Y=Math.ceil( (window.screen.height-H) / 2 )
  17. if (isie) { H=H+20+3;W=W+2;}
  18. var s=",width="+ W +",height="+ H ;
  19. if (isie && iswin) {
  20. var chromeTIThtml=''+
  21. '<html>\n'+
  22. '<head>\n'+
  23.  
  24. '<META HTTP-EQUIV="imagetoolbar" CONTENT="no">'+
  25.  
  26. '<style type="text/css">\n'+
  27. '#crtMOVE {position:absolute;left:0px;top:0px;z-index:2;}\n'+
  28. '#txtTITLE {position:absolute;left:0px;top:0px;width:100%;height:20px;z-index:1;clip:rect(0,100%,20,0);}\n'+
  29. '#btnCLOSE {position:absolute;left:-20px;top:4px;width:11px;height:11px;z-index:3;clip:rect(0,11,11,0);}\n'+
  30. '#btnMINI {position:absolute;left:-20px;top:4px;width:11px;height:11px;z-index:3;clip:rect(0,11,11,0);}\n'+
  31. '#grfCLOCK {position:absolute;left:-20px;top:4px;width:11px;height:11px;z-index:3;clip:rect(0,11,11,0);}\n'+
  32. '</style>\n'+
  33. '<script language="javascript">\n'+
  34. 'var imgCLOSEdwn=new Image();imgCLOSEdwn.src="'+ CLOSEdwn +'"\n'+
  35. 'var imgCLOSEup=new Image();imgCLOSEup.src="'+ CLOSEup +'"\n'+
  36. 'var imgCLOSEovr=new Image();imgCLOSEovr.src="'+ CLOSEovr +'"\n'+
  37. 'var imgMINIdwn=new Image();imgMINIdwn.src="'+ MINIdwn +'"\n'+
  38. 'var imgMINIup=new Image();imgMINIup.src="'+ MINIup +'"\n'+
  39. 'var imgMINIovr=new Image();imgMINIovr.src="'+ MINIovr +'"\n'+
  40. 'var CLOCKgrfImg=new Image();CLOCKgrfImg.src="'+ CLOCKgrf +'"\n'+
  41. 'document.onselectstart=new Function("return false;")\n'+
  42. 'document.ondragstart=new Function("moveWIN();return false;")\n'+
  43. 'document.oncontextmenu=new Function("return false;")\n'+
  44. 'document.onmousemove=moveWIN\n'+
  45. 'winSTATUS="up"\n'+
  46. 'function setLAYOUT() {\n'+
  47. 'document.all["btnCLOSE"].style.pixelLeft=document.body.clientWidth-18\n'+
  48. 'if ( top.mainloaded ) {\n'+
  49. 'document.all["grfCLOCK"].style.visibility="hidden"\n'
  50. if (isv55) {
  51. chromeTIThtml +=''+
  52. 'document.all["btnMINI"].style.visibility="visible"\n'+
  53. 'document.all["btnMINI"].style.pixelLeft=document.body.clientWidth-38\n'
  54. }
  55. chromeTIThtml +=''+
  56. '}\n'+
  57. 'else {\n'+
  58. 'document.all["btnMINI"].style.visibility="hidden"\n'+
  59. 'document.all["grfCLOCK"].style.pixelLeft=document.body.clientWidth-38\n'+
  60. 'setTimeout("setLAYOUT()",500)\n'+
  61. '}\n'+
  62. '}\n'+
  63. 'function minimizeWIN() {\n'+
  64. 'top.window.moveTo(0,-4000)\n'+
  65. 'if ( (top.opener) && (!top.opener.closed) ) { top.opener.window.focus();}\n'+
  66. 'top.window.blur()\n'+
  67. '}\n'+
  68. 'function moveWIN() {\n'+
  69. 'if ( winSTATUS=="down") {\n'+
  70. 'document.body.bgColor="'+winBGCOLORsel+'"\n'+
  71. 'parent.bordeM.document.body.bgColor="'+winBORDERCOLORsel+'"\n'+
  72. 'parent.bordeT.document.body.bgColor="'+winBORDERCOLORsel+'"\n'+
  73. 'parent.bordeB.document.body.bgColor="'+winBORDERCOLORsel+'"\n'+
  74. 'parent.bordeL.document.body.bgColor="'+winBORDERCOLORsel+'"\n'+
  75. 'parent.bordeR.document.body.bgColor="'+winBORDERCOLORsel+'"\n'+
  76. 'ofx=event.x\n'+
  77. 'ofy=event.y\n'+
  78. 'winSTATUS="drag"\n'+
  79. '}\n'+
  80. 'else if ( winSTATUS=="drag") {\n'+
  81. 'px=event.screenX-ofx-1\n'+
  82. 'py=event.screenY-ofy-1\n'+
  83. 'top.window.x=px\n'+
  84. 'top.window.y=py\n'+
  85. 'top.window.moveTo(px,py)\n'+
  86. '} else {\n'+
  87. 'document.body.bgColor="'+winBGCOLOR+'"\n'+
  88. 'parent.bordeM.document.body.bgColor="'+winBORDERCOLOR+'"\n'+
  89. 'parent.bordeT.document.body.bgColor="'+winBORDERCOLOR+'"\n'+
  90. 'parent.bordeB.document.body.bgColor="'+winBORDERCOLOR+'"\n'+
  91. 'parent.bordeL.document.body.bgColor="'+winBORDERCOLOR+'"\n'+
  92. 'parent.bordeR.document.body.bgColor="'+winBORDERCOLOR+'"\n'+
  93. 'winStatus="up"\n'+
  94. '}\n'+
  95. '}\n'+
  96. '</script>\n'+
  97. '<script language="JavaScript">'+
  98. '<!--'+
  99. 'var timer = \'\';'+
  100. 'function blurred() {'+
  101. '    timer = setTimeout(\'self.focus()\',1000);'+
  102. '}'+
  103. 'function focused() {'+
  104. '    if (timer != \'\')'+
  105. '        clearTimeout(timer);'+
  106. '}\n\n'+
  107. '</script>\n'+
  108. '</head>\n'+
  109. '<body onBlur="blurred()" onFocus="focused()" onresize="setLAYOUT()" bgcolor='+winBGCOLOR+'>\n'+
  110. '<div id=crtMOVE><img onmousedown="winSTATUS=\'down\';moveWIN()" onmouseup="winSTATUS=\'up\';moveWIN()" border=0 src="'+NONEgrf+'" width=110% height=500></div>\n'+
  111. '<div id=txtTITLE>'+ '<table width=100% height=20 border=0 cellpadding=0 cellspacing=0><tr><td valign=middle align=left>'+titHTML+'</td></tr></table>' +'</div>\n'+
  112. '<div id=btnCLOSE><img name=imgCLOSE src="'+ CLOSEup +'" border=0 width=11 height=11 onmouseover="this.src=imgCLOSEovr.src" onmouseout="btnSTATUS=false;this.src=imgCLOSEup.src" onmouseup="this.src=imgCLOSEup.src" onmousedown="this.src=imgCLOSEdwn.src" onclick="top.window.close()"></div>\n'+
  113. '<div id=btnMINI><img name=imgMINI src="'+ MINIup+'" border=0 width=11 height=11 onmouseover="this.src=imgMINIovr.src" onmouseout="btnSTATUS=false;this.src=imgMINIup.src" onmouseup="this.src=imgMINIup.src" onmousedown="this.src=imgMINIdwn.src" onclick="minimizeWIN()"></div>\n'+
  114. '<div id=grfCLOCK><img name=imgCLOCK src="'+ CLOCKgrf +'" border=0 width=11 height=11></div>\n'+
  115. '<script>setLAYOUT()</script>\n'+
  116. '</body>\n'+
  117. '</html>\n'
  118. var chromeFRMhtml='' +
  119. '<HTML>\n'+
  120. '<HEAD>\n'+
  121. '<TITLE>'+ titWIN +'</TITLE>\n'+
  122. '</HEAD>\n'+
  123. '<script>\n'+
  124. 'top.mainloaded=false\n'+
  125. 'function generatetitle() {\n'+
  126. 'if( window.frames["frmTIT"] && window.frames["bordeL"] && window.frames["bordeB"] && window.frames["bordeR"] && window.frames["bordeM"] ) {\n'+
  127. 'frmTIT.document.bgColor="'+ winBGCOLOR +'"\n'+
  128. 'frmTIT.document.open()\n'+
  129. 'frmTIT.document.write( "'+ quitasaltolinea(chromeTIThtml) +'" )\n'+
  130. 'frmTIT.document.close()\n'+
  131. 'bordeM.document.bgColor="'+ winBORDERCOLOR +'"\n'+
  132. 'bordeL.document.bgColor="'+ winBORDERCOLOR +'"\n'+
  133. 'bordeR.document.bgColor="'+ winBORDERCOLOR +'"\n'+
  134. 'bordeB.document.bgColor="'+ winBORDERCOLOR +'"\n'+
  135. 'bordeT.document.bgColor="'+ winBORDERCOLOR +'"\n'+
  136. '} else {\n'+
  137. 'setTimeout("generatetitle()",20)\n'+
  138. '}\n'+
  139. '}\n'+
  140. 'top.window.h='+H+'\n'+
  141. 'top.window.w='+W+'\n'+
  142. 'top.window.x='+X+'\n'+
  143. 'top.window.y='+Y+'\n'+
  144. 'generatetitle()\n'+
  145. '</script>\n'+
  146. '<frameset onload="top.mainloaded=true" onfocus="top.window.moveTo(top.window.x,top.window.y)" border=0 framespacing=0 frameborder=0 cols="1,100%,1">\n'+
  147. '<frame name=bordeL src="about:blank" scrolling=no noresize>\n'+
  148. '<frameset border=0 framespacing=0 frameborder=0 rows="1,20,1,100%,1">\n'+
  149. '<frame name=bordeT src="about:blank" scrolling=no noresize>\n'+
  150. '<frame name=frmTIT src="about:blank" scrolling=no noresize>\n'+
  151. '<frame name=bordeM src="about:blank" scrolling=no noresize>\n'+
  152. '<frame name=main src="'+theURL+'">\n'+
  153. '<frame name=bordeB src="about:blank" scrolling=no noresize>\n'+
  154. '</frameset>\n'+
  155. '<frame name=bordeR src="about:blank" scrolling=no noresize>\n'+
  156. '</frameset>\n'+
  157. '</HTML>'
  158.  
  159. var CWIN=window.open( "",wname,"fullscreen=1"+s)
  160. CWIN.resizeTo(Math.ceil(W),Math.ceil(H))
  161. CWIN.moveTo(Math.ceil(X),Math.ceil(Y))
  162. CWIN.document.open()
  163. CWIN.document.write( chromeFRMhtml )
  164. CWIN.document.close()
  165. }else{
  166. var CWIN=window.open(theURL,wname,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1"+s,true)
  167. }
  168. CWIN.focus()
  169. return CWIN
  170. }
  171.  
  172. function quitasaltolinea(txt) {
  173. var salida=txt.toString()
  174. var re=/\\/g;var salida=salida.replace(re,"\\\\");
  175. re=/\//g;var salida=salida.replace(re,"\\\/");
  176. re=/\"/g;var salida=salida.replace(re,"\\\"");
  177. re=/\'/g;var salida=salida.replace(re,"\\\'");
  178. re=/\n/g;var salida=salida.replace(re,"\\n");
  179. return salida
  180. }
  181.